"""
规格选项管理序列化器
"""

from rest_framework import serializers
from goods.models import SpecificationOption, SPUSpecification

class OptionModelSerialzier(serializers.ModelSerializer):
    """
    规格选项管理
    """
    spec = serializers.StringRelatedField()
    spec_id = serializers.IntegerField()
    class Meta:
        model = SpecificationOption
        fields = ['id', 'value', 'spec', 'spec_id']


class OptionSpecificationSerializer(serializers.ModelSerializer):
    """
    可选规格列表信息
    """
    class Meta:
        model = SPUSpecification
        fields = ['id', 'name']